[SAP ABAP开发技术总结]权限对象检查

 

20.14.             权限检查

AT SELECTION-SCREEN.
 
DATA: BEGIN OF lt_bukrs OCCURS 0,
    bukrs
TYPE t001-bukrs,
   
END OF lt_bukrs.
 
SELECT bukrs FROM t001 INTO CORRESPONDING FIELDS OF TABLE lt_bukrs  WHERE bukrs IN s_bukrs.
 
LOOP AT lt_bukrs
.
    AUTHORITY-CHECK OBJECT 'ZDABAP'   [ɔ:ˈθɔriti]
          
ID 'VKORG' DUMMY                      销售组织
          
ID 'BUKRS' FIELD lt_bukrs-bukrs        公司代码
          
ID 'WERKS' DUMMY                      工厂
          
ID 'EKORG' DUMMY                      采购组织
          
ID 'KOKRS' DUMMY
          
ID 'GSBER'
DUMMY
          
ID 'SEGMENT' DUMMY.

   
IF sy-subrc <> 0."
     
MESSAGE s001(00) DISPLAY LIKE 'E' WITH 'You do not have authorization to access company code:' lt_bukrs-bukrs.
     
STOP.
   
ENDIF.
 
ENDLOOP.
ENDFORM.

posted @ 2015-02-01 15:48  江正军  阅读(7269)  评论(0编辑  收藏  举报